//
//  WindTableViewCell.m
//  StationManager
//
//  Created by 泽华伟业 on 17/3/10.
//  Copyright © 2017年 Helong. All rights reserved.
//

#import "WindTableViewCell.h"

@interface WindTableViewCell ()

//风向Label
@property (nonatomic,strong) UILabel *fxLabel;
//风速label
@property (nonatomic,strong) UILabel *fsLabel;
//观测时间label
@property (nonatomic,strong) UILabel *timeLabel;

@end

@implementation WindTableViewCell

- (UILabel *)fxLabel{
    if (!_fxLabel) {
        _fxLabel = [[UILabel alloc]init];
        [self addAndSetLableWithLabel:_fxLabel];
        [_fxLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView);
            make.top.bottom.equalTo(self.contentView);
            make.width.equalTo(self.contentView).dividedBy(4);
        }];
    }
    return _fxLabel;
}

- (UILabel *)fsLabel{
    if (!_fsLabel) {
        _fsLabel = [[UILabel alloc]init];
        [self addAndSetLableWithLabel:_fsLabel];
        [_fsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_fxLabel.mas_right).offset(-15*wl);
            make.top.bottom.equalTo(self.contentView);
            make.width.equalTo(_fxLabel);
        }];
    }
    return _fsLabel;
}

- (UILabel *)timeLabel{
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        [self addAndSetLableWithLabel:_timeLabel];
        [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_fsLabel.mas_right);
            make.top.bottom.equalTo(self.contentView);
            make.right.equalTo(self.contentView);
        }];
    }
    return _timeLabel;
}

- (void)addAndSetLableWithLabel:(UILabel *)label{
    [self.contentView addSubview:label];
    [label setTextAlignment:NSTextAlignmentCenter];
    [label setFont:TEXT_FONT];
    
}

- (void)setTextForLabelWithDirection:(NSString *)direction Speed:(NSString *)speed Time:(NSString *)time{
    [self.fxLabel setText:direction];
    [self.fsLabel setText:speed];
    [self.timeLabel setText:time];

}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
